from flask import Flask
from flask_cors import CORS
from api import test_api, user_api, auth_api, scale_api, patient_list_api, patient_user_info_api, doctor_user_api, psychological_list_api, ratings_list_api, ratings_time_sum_api, problem_list_api

#  创建蓝图对象
app = Flask(__name__)
CORS(app, supports_credentials=True) # 启用CORS（跨域资源共享），并允许携带凭证（如cookies）

app.register_blueprint(test_api, url_prefix='/test') # 注册test_api蓝图到Flask应用中，并设置URL前缀为'/api/test',意味着所有在test_api中定义的路由都会以/api/test为前缀。
app.register_blueprint(auth_api, url_prefix='/auth')
app.register_blueprint(user_api, url_prefix='/user')
app.register_blueprint(scale_api, url_prefix='/scale')
app.register_blueprint(doctor_user_api, url_prefix='/api/doctoruser')

app.register_blueprint(patient_list_api, url_prefix='/api/patient_list')
app.register_blueprint(patient_user_info_api, url_prefix='/api/patient_user_info')
app.register_blueprint(psychological_list_api, url_prefix='/api/psychological_list')
app.register_blueprint(ratings_list_api, url_prefix='/api/ratings_list')
app.register_blueprint(ratings_time_sum_api, url_prefix='/api/ratings_time_sum')
app.register_blueprint(problem_list_api, url_prefix='/api/problem_list')

# 调试信息
print(app.url_map)

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=30010, debug=True)
